package com.hl;

import com.hl.entity.College;
import com.hl.entity.Teacher;
import com.hl.entity.TeacherAndCollege;
import com.hl.mapper.CollegeMapper;
import com.hl.mapper.TeacherNoteMapper;
import com.hl.util.MybatisUtils;
import org.apache.ibatis.session.SqlSession;

import java.awt.event.ItemEvent;
import java.io.IOException;
import java.util.List;

public class Test6Note {
    public static void main(String[] args) throws IOException {
        SqlSession sqlSession = MybatisUtils.getSqlSession();
        TeacherNoteMapper mapper = sqlSession.getMapper(TeacherNoteMapper.class);

/*        List<Teacher> list = mapper.selectAllTeachers();
        for (Teacher teacher : list) {
            System.out.println(teacher);
        }*/

/*
        Teacher teacher = mapper.selectTeacherById(2);
        System.out.println(teacher);
*/

/*        Teacher addTeacher = new Teacher();
        addTeacher.setTname("平二");
        addTeacher.setCollegeId(2);
        int row = mapper.addTeacher(addTeacher);
        System.out.println(row > 0 ? "新增成功":"新增失败");*/

/*        Teacher updateTeacher = new Teacher();
        updateTeacher.setTname("平二狗");
        updateTeacher.setTid(11);
        int row2 = mapper.updateTeacherById(updateTeacher);
        System.out.println(row2 > 0 ? "修改成功":"修改失败");*/

/*        int row3 = mapper.deleteTeacherById(11);
        System.out.println(row3 > 0 ? "删除成功":"删除失败");*/

/*        List<TeacherAndCollege> teacherAndColleges = mapper.selectTeacherAndCollege();
        for (TeacherAndCollege teacherAndCollege : teacherAndColleges) {
            System.out.println(teacherAndCollege);
        }*/

/*        List<Teacher> list1 = mapper.selectTeacherAndCollege2();
        for (Teacher teacher1 : list1) {
            System.out.println(teacher1);
        }*/

        List<Teacher> list2 = mapper.selectTeacherAndCourse();
        for (Teacher teacher : list2) {
            System.out.println(teacher);
        }


        MybatisUtils.closeSqlSession(sqlSession);

    }
}
